
import EventManager from "../../../Common/EventManager";
import http_request from "../../../Common/http_request";
import { EventType } from "../../../GameSpecial/GameEventType";
import UserService from "../../services/userService";
import { mgrs, sers } from "../../system/OverallSystem ";
import PageBase from "./pageBase";

const { ccclass, property } = cc._decorator;

@ccclass
export default class cebianlan extends PageBase {


    @property(cc.Node)
    tiaozhuanBtn:cc.Node = null

    @property(cc.Node)
    lingquBtn:cc.Node = null


    onLoad() {

    }

    start() {
        if(!window['tt'].navigateToScene){
            this.node.parent = null
        }

        if(window['sceneCode'] == '101001' || window['sceneCode'] == '021036'){
            this.tiaozhuanBtn.active = false
            this.lingquBtn.active =  true
        }

        EventManager.on(EventType.UIEvent.showCheckSceneBtn,()=>{
            if(this && this.node){
                this.show()
            }
        },this)


    }

    show(){
        if(window['sceneCode'] == '101001' || window['sceneCode'] == '021036'){
            this.tiaozhuanBtn.active = false
            this.lingquBtn.active =  true
        }
    }

    queding(){
        let  taht = this
        window['tt'].navigateToScene({
            scene: "sidebar",
            success: (res) => {
                console.log("navigate to scene success");
                // 跳转成功回调逻辑
            },
            fail: (res) => {
                console.log("navigate to scene fail: ", res);
                // 跳转失败回调逻辑
            },
        });
    }

    lingqu(){
        sers().userSrv.setCheckScene(1)
        sers().userSrv.addCoin(50)
        EventManager.emit(EventType.UIEvent.SignInList)
        EventManager.emit(EventType.UIEvent.showCheckSceneBtn)
        this.close()
    }

    // update (dt) {}
}
